<template>
    <div id="developmentpoc">
        <p class="title">开发调试</p>
            <div class="headerbarpoc">账号查询
                <el-input placeholder="即APP帐号体系，例如单个QQ号、微信号、邮箱、手机、ID等" v-model="useraccountpoc" style="width:500px;margin:0px 10px"></el-input>
                <el-button type="primary" @click="accountQuechange">查 询</el-button>
            </div>
            <div class="mainconteler">
            <el-main class="main-table-box">
                    <!-- 表格 -->
                    <el-table ref="tableDatabar" :data="tableDatabar" style="width:100%">
                        <el-table-column prop="abc" label="token" width="180"
                        :show-overflow-tooltip="true">
                        </el-table-column>
                        <el-table-column prop="sde" label="机型" width="auto" :show-overflow-tooltip="true">
                        </el-table-column>
                        <el-table-column prop="fro" label="系统版本" width="auto" :show-overflow-tooltip="true">
                        </el-table-column>
                        <el-table-column prop="vos" label="APP版本" width="auto" :show-overflow-tooltip="true">
                        </el-table-column>
                        <el-table-column prop="lop" label="SDK版本" width="auto" :show-overflow-tooltip="true">
                        </el-table-column>
                        <el-table-column prop="hwe" label="上次链接服务器时间" width="auto" :show-overflow-tooltip="true">
                        </el-table-column>
                        <el-table-column prop="xip" label="离线消息" width="auto" :show-overflow-tooltip="true">
                        </el-table-column>
                    </el-table>
                    <!-- 分页 -->
                    <el-pagination @current-change="handleCurrentChange" v-loading="tableLoading" :current-page="currentPage" :page-size="pagesize" layout="total, prev, pager, next" :total="totalCount" style="padding:20px 5px">
                    </el-pagination>
            </el-main>
            </div>
    </div>
</template>
<script type="text/ecmascript-6">
import api from '../../../../api/url'
import ajax from '../../../../api/ajax/mobilePushAjax'
import { mapGetters } from 'vuex'
// import {nextPage } from '../../../../assets/js/index'
import { Base64 } from 'js-base64'
export default {
    name: 'developmentpoc',
    data () {
        return {
            tableLoading: false, // 加载过程
            currentPage: 1, // 当前页码
            pagesize: 1000000, // 默认每页数据量
            totalCount: 0, // 默认数据总数
            useraccountpoc: '', // 账号查询输入内容
            tableDatabar: [
            {
                abc: 'token1ios',
                sde: '华为',
                fro: 'android 1.0.24',
                vos: '6.351',
                lop: '86526SDK',
                hwe: '2018-10-03',
                xip: '1'
            },
            {
                abc: 'token2',
                sde: '魅族',
                fro: 'android 1.0.24',
                vos: '6.351',
                lop: '86526SDK',
                hwe: '2018-10-03',
                xip: '2'
            },
            {
                abc: 'token3',
                sde: '小米',
                fro: 'android 1.0.24',
                vos: '6.351',
                lop: '86526SDK',
                hwe: '2018-10-03',
                xip: '3'
            }
            ] // 表格数据
        }
    },
    computed: {
        ...mapGetters(['v3AppKey', 'v3SecretKey', 'v3platform'])
    },
    methods: {
    // 获取页码
    handleCurrentChange (val) {
        this.currentPage = val
    },
    accountQuechange () {
            if (this.useraccountpoc !== '') {
            let Baseencode = Base64.encode(this.v3AppKey + ':' + this.v3SecretKey)
            let accountcrv = {
                Authorization: 'Basic' + ' ' + Baseencode,
                'Content-Type': 'application/json'
                }
            let accountvalue = {
                operator_type: 1,
                platform: this.v3platform,
                account_list: [
                    {
                       account: this.useraccountpoc,
                       account_type: 0
                    }
                ]
            }
            ajax.post(api.SHAKEDOWN_TEST, accountvalue, accountcrv).then(res => {
                    console.log('333', res.account_tokens[0].token_list) // token号
                    // this.tableLoading = false
                    // this.tableData = []
                    // this.tableDatabar = res.result.list
                    // this.totalCount = parseInt(res.result.Total)
        })
    }
    }
    },
    created () {
       this.totalCount = this.tableDatabar.length
    }
}
</script>

<style lang="stylus" rel="stylesheet/stylus">
    #developmentpoc
      height: 100%
      width: 100%
      .title
        font-size: 18px
        height: 60px
        line-height: 60px
        background #fff
        padding-left 15px
        margin-bottom: 10px
      .headerbarpoc
        height: 60px
        line-height: 60px
        background #fff
        margin-bottom 10px
        padding 0px 15px
       .mainconteler
         height: 100%
         width: 100%
         padding: 0px 10px
         background-color: #ffff
         height calc(100% - 140px)
         overflow: auto
         overflow-x hidden
</style>
